package com.zmn.oms.common.constant;

import com.zmn.consts.GlobalConsts;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 逻辑是和逻辑否的枚举
 *
 * @author hankangshuai
 * @since 2019/11/1
 **/
@AllArgsConstructor
@Getter
public enum BooleanEnum implements CodeEnum {
    // 空
    NONE(GlobalConsts.NONE),
    // 非
    NOT(GlobalConsts.NO),
    // 是
    YES(GlobalConsts.YES);
    // 常量值
    Integer code;

    static BooleanEnum booleanOf(Boolean aBoolean) {
        if (Objects.isNull(aBoolean)) {
            return NONE;
        }
        return aBoolean ? YES : NOT;
    }
}
